<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags"%>

<!DOCTYPE html>
<html>
<head>
<my:head title="Кристинкин магазинчик"/>
</head>
<body>
	<my:header/>
	<my:nav/>

	<table id="goods_table">
		<tbody>
			<c:forEach var="item" items="${goodsItems}">
				<tr>
					<c:url value="item_view" var="itemViewUrl">
						<c:param name="id" value="${item.id}" />
					</c:url>

					<c:url value="item_modify" var="itemModifyUrl">
						<c:param name="id" value="${item.id}" />
					</c:url>

					<c:url value="image" var="itemImageUrl">
						<c:param name="id" value="${item.mainImage.id}" />
						<c:param name="width" value="200" />
						<c:param name="height" value="200" />
					</c:url>

					<td>
						<div class="thumbnails">
							<a href="${itemViewUrl}"> <img alt="изображение товара"
								src="${itemImageUrl}" title="Детали" />
							</a>
						</div>
					</td>

					<td class="goods_description">
						<div class="order_block">
							<div class="goods_price">
								<p>
									<span>${item.cost}</span> руб.
								</p>
							</div>

							<div class="goods_order">
								<c:if test='<%=request.isUserInRole("Kristinkin")%>'>
									<div class="secret_goods_oerde"
										style="float: right; margin-left: 10px">
										<a href="${itemModifyUrl}"><img src="img/modify.png"
											alt="Изменить" title="Изменить" class="button"></a>

										<form action='<c:url value="item_modify"/>' method="post">
											<input type="hidden" name="id" value="${item.id}"> <input
												type="hidden" name="remove" value="true"> <input
												type="image" title="Детали" class="button"
												src="img/delete.png">
										</form>
									</div>
								</c:if>

								<div class="general_goods_order" style="float: right;">
									<form action='<c:url value="order"/>' method="post">
										<input type="hidden" name="id" value="${item.id}"> <input
											type="image" src="img/order.png" alt="Заказать"
											title="Заказать" class="button">
									</form>

									<a href="${itemViewUrl}"><img src="img/details.png"
										alt="Детали" title="Детали" class="button"></a>
								</div>
							</div>
						</div>

						<h3>
							<c:out value="${item.name}" />
						</h3>
						<p>
							<c:out value="${item.description}" />
						</p>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>

	<my:footer/>
</body>
</html>